//
//  LaunchVC.m
//  BrushFace
//
//  Created by timer_q on 16/1/27.
//  Copyright © 2016年 Zzz. All rights reserved.
//

#import "LaunchVC.h"
#import "NavHelper.h"

@interface LaunchVC ()<UIScrollViewDelegate>
{
    UIScrollView *_scrollView;
}
@end

@implementation LaunchVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.navBar setNavBackColor:[UIColor clearColor]];
    [self.navBar setHideLeftBtn:YES];
    
    [self UIConfig];
}
-(void)UIConfig{
    _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    _scrollView.pagingEnabled = YES;
    _scrollView.contentSize = CGSizeMake(SCREEN_WIDTH*4, 0);
    _scrollView.delegate = self;
    NSArray *array = @[@"launch1.PNG",@"launch2.PNG",@"launch3.PNG",@"launch4.PNG"];
    for (int i=0; i<4; i++) {
        UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(i*SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        image.image = [UIImage imageNamed:array[i]];
        [_scrollView addSubview:image];
        
        if (i==3) {
            image.userInteractionEnabled = YES;
            UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImage)];
            [image addGestureRecognizer:tap];
        }
    }
    [self.view addSubview:_scrollView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    if (scrollView.contentOffset.x>SCREEN_WIDTH*3+120) {
        [NavHelper gotoFindVC];
    }
}
- (void)tapImage{
        [NavHelper gotoFindVC];
}

@end
